package com.scalar.chiptrack.workflow;

import java.util.Hashtable;

import javax.swing.table.TableCellEditor;
public class RowEditorModel
{
     private Hashtable data;
     public RowEditorModel()
     {
         data = new Hashtable();
     }
     public void addEditorForRow(int row, int col, TableCellEditor e )
     {
         data.put( new Cell ( row, col ), e);
     }
     public void removeEditorForRow(int row, int col)
     {
         data.remove( new Cell ( row, col ) );
     }
     public TableCellEditor getEditor(int row, int col)
     {
         return (TableCellEditor)data.get( new Cell ( row, col ) );
     }

    public class Cell
    {
        int row = -1;
        int col = -1;
        public Cell ( int row, int col )
        {
            this.row = row;
            this.col = col;
        }

        public boolean equals(Object obj)
        {
            if ( obj instanceof Cell )
            {
                Cell temp = ( Cell )obj;
                if ( this.row == temp.row && this.col == temp.col )
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            return super.equals(obj);
        }

        public int hashCode()
        {
            return row*col;
        }
    }
 }



